package com.glela.common.dao.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.glela.common.dao.CFlagDao;
import com.glela.common.mapper.CFlagMapper;
import com.glela.common.model.CFlag;

/**
 * 
 * IAreaDao 实现类
 * @author liujie
 *
 */
@Repository
public class CFlagDaoImpl implements CFlagDao{

	@Autowired
	private CFlagMapper cFlagMapper;

	@Override
	public CFlag selectByKey(String key) {
		if(StringUtils.isEmpty(key)){
			return null;
		}
		return cFlagMapper.selectByKey(key);
	}

	@Override
	public int updateValueByKey(String key,Integer value) {
		if(StringUtils.isEmpty(key) || value==null){
			return 0;
		}
		CFlag cflag = new CFlag();
		cflag.setKey(key);
		cflag.setValue(value);
		return cFlagMapper.updateValueByKey(cflag);
	}

}
